cmake_minimum_required(VERSION 3.10)
project(Coding)

# 设置C++标准
set(CMAKE_CXX_STANDARD 17)

# 头文件路径
include_directories(
        src/Tools
        src/Sort
)

# Debug模式
# 在Clion"File->Settings->Build,Execution,Deployment->Cmake"中将"Build Directory"设置为"build/debug/temp"
if (CMAKE_BUILD_TYPE STREQUAL Debug)
    # 设置Debug模式下可执行文件输出路径
    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJECT_SOURCE_DIR}/build/debug/bin/)
    # 设置Debug模式下静态库(.a)文件输出路径
    set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${PROJECT_SOURCE_DIR}/build/debug/bin/)
    # 设置Debug模式下动态库(.so)文件输出路径
    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${PROJECT_SOURCE_DIR}/build/debug/bin/)
    # 添加库文件的链接目录
    link_directories(${CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG})
endif()

# Release模式
# 在Clion"File->Settings->Build,Execution,Deployment->Cmake"中将"Build Directory"设置为"build/release/temp"
if (CMAKE_BUILD_TYPE STREQUAL Release)
    # 设置Release模式下可执行文件输出路径
    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_SOURCE_DIR}/build/release/bin/)
    # 设置Release模式下静态库(.a)文件输出路径
    set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${PROJECT_SOURCE_DIR}/build/release/bin/)
    # 设置Release模式下动态库(.so)文件输出路径
    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${PROJECT_SOURCE_DIR}/build/release/bin/)
    # 添加库文件的链接目录
    link_directories(${CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE})
endif()

add_subdirectory(src/ArrayAndString)
add_subdirectory(src/Sort)
add_subdirectory(src/Hot100)
add_subdirectory(src/Test)

